package com.zx.sercurity;

public class AsyncResultWrapper<T> {

    private ProcessState state;
    private boolean inRisk;
    private final RiskEnum riskEnum;
    private T result;

    public AsyncResultWrapper(ProcessState state, boolean inRisk, RiskEnum riskEnum, T result) {
        this.state = state;
        this.inRisk = inRisk;
        this.riskEnum = riskEnum;
        this.result = result;
    }

    public AsyncResultWrapper<T> newState(ProcessState state){
        return new AsyncResultWrapper<>(state,inRisk,riskEnum,result);
    }

    public AsyncResultWrapper<T> newResult(T result){
        return new AsyncResultWrapper<>(state,inRisk,riskEnum,result);
    }

    public AsyncResultWrapper<T> inRisk(boolean inRisk){
        return new AsyncResultWrapper<>(state,inRisk,riskEnum,result);
    }

    public ProcessState getState() {
        return state;
    }

    public RiskEnum getRiskEnum() {
        return riskEnum;
    }

    public boolean isInRisk() {
        return inRisk;
    }

    public T getResult() {
        return result;
    }

}
